<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改密码 - Creeps</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .form-container {
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid #eee;
        }
        .form-group {
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: bold;
            color: #555;
        }
        input[type="password"] {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            box-sizing: border-box;
        }
        .action-buttons {
            text-align: center;
            margin-top: 30px;
        }
        .btn {
            display: inline-block;
            padding: 12px 24px;
            margin: 0 10px;
            text-decoration: none;
            border-radius: 5px;
            font-weight: bold;
            transition: background-color 0.3s;
            border: none;
            cursor: pointer;
            font-size: 16px;
        }
        .btn-primary {
            background-color: #007bff;
            color: white;
        }
        .btn-primary:hover {
            background-color: #0056b3;
        }
        .btn-secondary {
            background-color: #6c757d;
            color: white;
        }
        .btn-secondary:hover {
            background-color: #545b62;
        }
        .nav-link {
            display: inline-block;
            margin-bottom: 25px;
            color: rgba(100, 150, 255, 0.9);
            text-decoration: none;
            font-weight: 600;
            font-size: 1.1rem;
            transition: all 0.3s ease;
            padding: 10px 15px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(5px);
        }
        .nav-link:hover {
            color: white;
            background: rgba(100, 150, 255, 0.3);
            transform: translateX(5px);
            text-decoration: none;
        }
        .errorlist {
            color: #dc3545;
            list-style-type: none;
            padding: 0;
            margin: 5px 0 0;
            font-size: 14px;
        }
        .messages {
            list-style: none;
            padding: 0;
            margin-bottom: 20px;
        }
        .messages .success {
            background-color: #d4edda;
            color: #155724;
            padding: 12px;
            border-radius: 5px;
            margin-bottom: 10px;
        }
        .password-help {
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 20px;
            font-size: 14px;
            color: #666;
        }
        .password-help h3 {
            margin-top: 0;
            color: #444;
            font-size: 16px;
        }
        .password-help ul {
            margin: 10px 0 0;
            padding-left: 20px;
        }
    </style>
</head>
<body>
    <div class="form-container">
        <a href="{% url 'accounts:profile' %}" class="nav-link">← 返回个人资料</a>

        <h1>修改密码</h1>

        {% if messages %}
        <ul class="messages">
            {% for message in messages %}
            <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
            {% endfor %}
        </ul>
        {% endif %}

        <div class="password-help">
            <h3>密码要求</h3>
            <ul>
                <li>不能与您的个人信息太相似</li>
                <li>至少包含8个字符</li>
                <li>不能是常用密码</li>
                <li>不能全为数字</li>
            </ul>
        </div>

        <form method="post">
            {% csrf_token %}

            <div class="form-group">
                <label for="{{ form.old_password.id_for_label }}">当前密码</label>
                {{ form.old_password }}
                {{ form.old_password.errors }}
            </div>

            <div class="form-group">
                <label for="{{ form.new_password1.id_for_label }}">新密码</label>
                {{ form.new_password1 }}
                {{ form.new_password1.errors }}
            </div>

            <div class="form-group">
                <label for="{{ form.new_password2.id_for_label }}">确认新密码</label>
                {{ form.new_password2 }}
                {{ form.new_password2.errors }}
            </div>

            <div class="action-buttons">
                <button type="submit" class="btn btn-primary">修改密码</button>
                <a href="{% url 'accounts:profile' %}" class="btn btn-secondary">取消</a>
            </div>
        </form>
    </div>
</body>
</html>